home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2004 August / My Disc.iso / games / demo / Rapid gunner / RG_Setup.exe / common / corona.fx < prev    next >
Encoding:
Text File  |  2004-04-19  |  3.7 KB  |  139 lines

  1. // LF2 Engine
  2. // (C) 2002-3 7FX
  3. //---------------------------------------------------------------------------
  4. #include "common.fxh"
  5. //---------------------------------------------------------------------------
  6. // Common parameters
  7. // Desc
  8. string desc : Description = "Shader pro korony svetel.";
  9. // Requirements
  10. string req : Requirements = "Diffuse";
  11. // vertex format
  12. string vf : VertexFormat = "POSITION | DIFFUSEMAP"; // 65 (for export) - diffuse map used instead of corona map
  13. //---------------------------------------------------------------------------
  14. // Used constants
  15. const matrix cMtxWVP : WorldViewProjection;
  16. // Diffuse color, default white
  17. const float4 cDiffuse : Diffuse = {1.f, 1.f, 1.f, 1.f};
  18. // Matrices for fixed function technique
  19. const matrix cMtxW : World;
  20. // Sampler filters
  21. DECLARE_TEX_SAMPLER_VALUES;
  22. //---------------------------------------------------------------------------
  23. // Corona texture
  24. texture2D corona : DiffuseMap;
  25. /*<
  26.     string name = "lightflare";
  27. >;*/
  28. //---------------------------------------------------------------------------
  29. // Light map sampler
  30. sampler corona_sampler = sampler_state
  31. {
  32.     Texture = <corona>;
  33.     SET_TEX_SAMPLER_FILTERS;
  34.     AddressU = CLAMP;
  35.     AddressV = CLAMP;
  36. };
  37. //---------------------------------------------------------------------------
  38. // programs
  39. struct VS_OUTPUT
  40. {
  41.     float4 Position : POSITION;
  42.     float2 CoronaCoord : TEXCOORD0;
  43. };
  44.  
  45. // vertex shader
  46. VS_OUTPUT VS(float4 Position : POSITION, float2 CoronaCoord : TEXCOORD0)
  47. {
  48.     VS_OUTPUT Out = (VS_OUTPUT)0;
  49.     Out.Position = mul(Position, cMtxWVP);
  50.     Out.CoronaCoord = CoronaCoord;
  51.     return Out;
  52. }
  53.  
  54. // pixel shader
  55. float4 PS(VS_OUTPUT In) : COLOR
  56. {
  57.     return cDiffuse * tex2D(corona_sampler, In.CoronaCoord);
  58. }
  59.  
  60. //---------------------------------------------------------------------------
  61. // Technique with vertex and pixel shader
  62. technique vs11_ps11
  63. <
  64.     // streams for technique
  65.     string stream1 = "POSITION | DIFFUSEMAP";
  66. >
  67. {
  68.     pass p0
  69.     <
  70.         // stream mapping
  71.         string streammap = "stream1";
  72.     >
  73.     {
  74.         CullMode = NONE;
  75.     
  76.         VertexShader = compile vs_1_1 VS();
  77.         PixelShader  = compile ps_1_1 PS();
  78.     }
  79. }
  80. //---------------------------------------------------------------------------
  81. // Basic technique - vertex shader, no pixel shader
  82. technique vs11_ps0
  83. <
  84.     // streams for technique
  85.     string stream1 = "POSITION | DIFFUSEMAP";
  86. >
  87. {
  88.     pass p0
  89.     <
  90.         // stream mapping
  91.         string streammap = "stream1";
  92.     >
  93.     {
  94.         CullMode = NONE;
  95.         TextureFactor = <cDiffuse>;
  96.  
  97.         VertexShader = compile vs_1_1 VS();
  98.         
  99.         Sampler[0] = <corona_sampler>;
  100.         ColorOp[0] = Modulate;
  101.         ColorArg1[0] = TFactor;
  102.         ColorArg2[0] = Texture;
  103.         AlphaOp[0] = Modulate;
  104.         AlphaArg1[0] = TFactor;
  105.         AlphaArg2[0] = Texture;
  106.     }
  107. }
  108. //---------------------------------------------------------------------------
  109. // Basic technique - fixed function
  110. technique vs0_ps0
  111. <
  112.     // streams for technique
  113.     string stream1 = "POSITION | DIFFUSEMAP";
  114. >
  115. {
  116.     pass p0
  117.     <
  118.         // stream mapping
  119.         string streammap = "stream1";
  120.     >
  121.     {
  122.         // matrices
  123.         WorldTransform[0] = <cMtxW>;
  124.     
  125.         CullMode = NONE;
  126.         TextureFactor = <cDiffuse>;
  127.     
  128.         // simple multitexture
  129.         Sampler[0] = <corona_sampler>;
  130.         ColorOp[0] = Modulate;
  131.         ColorArg1[0] = TFactor;
  132.         ColorArg2[0] = Texture;
  133.         AlphaOp[0] = Modulate;
  134.         AlphaArg1[0] = TFactor;
  135.         AlphaArg2[0] = Texture;
  136.     }
  137. }
  138. //---------------------------------------------------------------------------
  139.